
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/TestViewModel.dart';
import 'package:flutter_ahj_app/app/NewLogin/LoginAtOnceView.dart';
import 'package:flutter_ahj_app/app/NewLogin/LoginPageView.dart';
import 'package:flutter_ahj_app/app/NewMine/AboutUsPageView.dart';
import 'package:flutter_ahj_app/app/NewMine/AccountDetailView.dart';
import 'package:flutter_ahj_app/app/NewMine/AccountViewModel.dart';
import 'package:flutter_ahj_app/app/NewMine/ChangePswdView.dart';
import 'package:flutter_ahj_app/app/NewMine/ChangeSFView.dart';
import 'package:flutter_ahj_app/app/NewMine/ResetPswdView.dart';
import 'package:flutter_ahj_app/app/NewMine/SureYouView.dart';
import 'package:flutter_ahj_app/app/NewMine/WjpswdView.dart';
import 'package:flutter_ahj_app/app/db/cyPageView.dart';
import 'package:flutter_ahj_app/app/db/dbPageView.dart';
import 'package:flutter_ahj_app/app/db/fqPageView.dart';
import 'package:flutter_ahj_app/app/login/YiJianLogInView/YijianLogInView.dart';
import 'package:flutter_ahj_app/app/login/view/login_view.dart';
import 'package:flutter_ahj_app/app/NewLogin/LoginViewModel.dart';
import 'package:flutter_ahj_app/app/pctask/PcrwViewModel.dart';
import 'package:flutter_ahj_app/app/pctask/PcrwyhDetailView.dart';
import 'package:flutter_ahj_app/app/pctask/pcrwList/PCrwDetailView.dart';
import 'package:flutter_ahj_app/app/pctask/pcrwList/PCrwSecDetailView.dart';
import 'package:flutter_ahj_app/app/pctask/pcrwList/PcrwView.dart';
import 'package:flutter_ahj_app/app/pctask/startPcView/PCrwStartDetailView.dart';
import 'package:flutter_ahj_app/app/pctask/startPcView/PCrwStartView.dart';
import 'package:flutter_ahj_app/app/pctask/startPcView/PCrwYhdjPageView.dart';
import 'package:flutter_ahj_app/app/regist/ptxy/view/ptxy_view.dart';
import 'package:flutter_ahj_app/app/regist/ptxy/viewModel/ptxy_viewModel.dart';
import 'package:flutter_ahj_app/app/regist/view/RegisteredNewView.dart';
import 'package:flutter_ahj_app/app/regist/viewmodel/RegistViewModel.dart';
import 'package:flutter_ahj_app/app/yhpc/YhpcViewModel.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/ChooseBuMen.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/ChoosePclx.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/ChoosePcnr.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/ChoosePerson.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/CreateRWView.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/PcnrView.dart';
import 'package:flutter_ahj_app/app/yhpc/createRW/SelectPcnr.dart';
import 'package:flutter_ahj_app/app/yhpc/yhdj/ChoosePcdxView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhdj/ChoosePcxView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhdj/ChoosePersonDan.dart';
import 'package:flutter_ahj_app/app/yhpc/yhdj/ChooseYhlbView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhdj/ChooseZglxView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhdj/YhdjPageView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhDetailView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhzlView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhzlhcView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhzlpdView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhzlyhDetailView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhzlysView.dart';
import 'package:flutter_ahj_app/app/yhpc/yhzl/YhzlzgView.dart';
import 'package:flutter_ahj_app/app_scene.dart';
import 'package:flutter_ahj_app/base/basewidget/view/webViewUntil.dart';
import 'package:flutter_ahj_app/base/basewidget/viewmodel/ViewModelProvider.dart';
import 'package:flutter_ahj_app/base/basewidget/viewmodel/WebViewModel.dart';
import 'package:flutter_ahj_app/base/utils/showImage.dart';
import 'package:flutter_ahj_app/base/values/SQColor.dart';
import 'package:flutter_ahj_app/root_scene.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'app/androidUpdata/view/UpdataView.dart';
import 'app/androidUpdata/viewModel/UpdataViewModel.dart';
import 'app/changeDefaultPwd/ChangeDefaultPWD.dart';
import 'app/changeDefaultPwd/ChangeDefaultPWDViewModel.dart';
import 'app/companyInfo/view/CompanyInfoView.dart';
import 'app/companyInfo/viewModel/CompanyInfoViewModel.dart';
import 'app/forgetPWD/ForgetPWD2.dart';
import 'app/forgetPWD/ForgetPWDViewModel.dart';
import 'app/selectkaihuhang/KaiHuHangView.dart';
import 'app/selectkaihuhang/KaiHuHangViewModel.dart';
import 'base/basewidget/viewmodel/ViewModelProvider.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

class AppModule extends Module {
  static GlobalKey<NavigatorState> navigatorKey=GlobalKey();
  @override
  List<Bind> get binds => [];
  @override
  List<ModularRoute> get routes => [
        ChildRoute('/loginView',
            child: (context, args) => ViewModelProvider(
                  viewModel: LoginViewModel(),
                  child: LogInPage1(),
                )),
        ChildRoute('/LoginPageView',
            child: (context, args) => ViewModelProvider(
                  viewModel: LoginViewModel(),
                  child: LoginPageView(),
                )),
        ChildRoute('/WebViewUntil',
            child: (context, args) => ViewModelProvider(
                  viewModel: WebViewModel(),
                  child: WebViewUntil(args: args.data),
                )),
        ChildRoute('/',
            child: (context, args) => MaterialApp(
                onGenerateRoute: (RouteSettings settings) {
                  print('build route for ${settings.name}');
                  var routes = <String, WidgetBuilder>{

                    "/WebViewUntil": (context) => ViewModelProvider(
                          viewModel: WebViewModel(),
                          child: WebViewUntil(
                            args: settings.arguments,
                          ),
                        ),
                    
                    "/login": (context) => ViewModelProvider(
                          viewModel: LoginViewModel(),
                          child: YijianLogInView(
                            inputVC: settings.arguments,
                          ),
                        ),
                    "/LoginPageView": (context) => ViewModelProvider(
                          viewModel: LoginViewModel(),
                          child: LoginPageView(
                            // inputVC: settings.arguments,
                          ),
                        ),
                    //一键登录
                    "/LoginAtOnceView": (context) => ViewModelProvider(
                      viewModel: TestViewModel(),
                      child: LoginAtOnceView(
                        // inputVC: settings.arguments,
                      ),
                    ),
                    //登录页面
                    "/home": (context) => RootScene(),
                    //首页
                    "/regist": (context) => ViewModelProvider(
                          viewModel: RegistViewModel(),
                          child: RegisteredView(),
                        ),
                    
                    "/updata": (context) => ViewModelProvider(
                          viewModel: UpdataViewModel(),
                          child: UpdataView(
                            version: settings.arguments,
                          ),
                        ),
                    "/DbPageView": (context) => ViewModelProvider(
                      viewModel: TestViewModel(),
                      child: DbPageView(),
                    ),
                    "/FQPageView": (context) => ViewModelProvider(
                      viewModel: TestViewModel(),
                      child: FQPageView(),
                    ),
                    "/CyPageView": (context) => ViewModelProvider(
                      viewModel: TestViewModel(),
                      child: CyPageView(),
                    ),
                    /// 关于我们 CompanyInfoView
                    "/CompanyInfoView": (context) => ViewModelProvider(
                          viewModel: CompanyInfoViewModel(),
                          child: CompanyInfoView(),
                        ),

                    ///关于
                    "/AboutUsPageView": (context) => ViewModelProvider(
                          viewModel: TestViewModel(),
                          child: AboutUsPageView(),
                        ),
                    ///账号安全
                    "/AccountDetailView": (context) => ViewModelProvider(
                      viewModel: AccountViewModel(),
                      child: AccountDetailView(),
                    ),

                    ///修改密码
                    "/ChangePswdView": (context) => ViewModelProvider(
                          viewModel: AccountViewModel(),
                          child: ChangePswdView(),
                        ),

                    
                    ///修改密码 ChangePasswordView
                    "/SureYouView": (context) => ViewModelProvider(
                          viewModel: AccountViewModel(),
                          child: SureYouView(),
                        ),
                    "/WjpswdView": (context) => ViewModelProvider(
                      viewModel: AccountViewModel(),
                      child: WjpswdView(),
                    ),

                    ///重置密码
                    "/ResetPswdView": (context) => ViewModelProvider(
                      viewModel: AccountViewModel(),
                      child: ResetPswdView(
                        settings.arguments
                      ),
                    ),

                    ///修改默认
                    "/ChangeDefaultPWD": (context) => ViewModelProvider(
                          viewModel: ChangeDefaultPWDViewModel(),
                          child: ChangeDefaultPWD(),
                        ),

                    
                    "/select_kaihu_hang": (context) => ViewModelProvider(
                          viewModel: KaiHuHangViewModel(),
                          child: KaiHuHangView(
                            params: settings.arguments,
                          ),
                        ),
                    


                    ///忘记密码2
                    "/ForgetPWD2": (context) => ViewModelProvider(
                          viewModel: ForgetPWDViewModel(),
                          child: ForgetPWD2(settings.arguments),
                        ),

                    
                    // PTXYView
                    "/PTXYView": (context) => ViewModelProvider(
                          viewModel: PTXYViewModel(),
                          child: PTXYView(
                            type: settings.arguments,
                          ),
                        ),

                    // 创建任务
                    "/CreateRWView": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: CreateRWView(rwMap: settings.arguments,),
                        ),

                    // 选择部门
                    "/ChooseBuMen": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: ChooseBuMen(),
                        ),

                    // 选择排查类型
                    "/ChoosePclx": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: ChoosePclx(),
                        ),

                        // 选择排查人
                    "/ChoosePerson": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: ChoosePerson(chooseMap: settings.arguments),
                        ),

                      
                        // 选择排查内容
                    "/ChoosePcnr": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: ChoosePcnr(),
                        ),

                        
                         // 选择排查内容
                    "/SelectPcnr": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: SelectPcnr(
                            settings.arguments
                          ),
                        ),
                        
                         // 选择排查内容
                    "/PcnrView": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: PcnrView(
                            settings.arguments
                          ),
                        ),

                        // 隐患登记
                    "/YhdjPageView": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: YhdjPageView(hazardId: settings.arguments,),
                        ),

                    // 隐患治理
                    "/YhzlView": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: YhzlView(),
                        ),

                    // 隐患详情
                    "/YhDetailView": (context) => ViewModelProvider(
                          viewModel: YhpcViewModel(),
                          child: YhDetailView(id:  settings.arguments,),
                        ),
                    
                    ///排查任务
                    "/PcrwView": (context) => ViewModelProvider(
                          viewModel: PcrwViewModel(),
                          child: PcrwView(),
                        ),

                    ///排查任务执行详情
                    "/PCrwDetailView": (context) => ViewModelProvider(
                          viewModel: PcrwViewModel(),
                          child: PCrwDetailView(hazardInvestigationTaskId: settings.arguments,),
                        ),

                    ///排查任务详情
                    "/PCrwSecDetailView": (context) =>
                        ViewModelProvider(
                          viewModel: PcrwViewModel(),
                          child: PCrwSecDetailView(hazardInvestigationRiskPointId: settings.arguments),
                        ),

                    ///切换身份
                    "/ChangeSFView": (context) =>
                        ViewModelProvider(
                          viewModel: AccountViewModel(),
                          child: ChangeSFView(),
                        ),

                    ///开始排查
                    "/PCrwStartView": (context) => ViewModelProvider(
                          viewModel: PcrwViewModel(),
                          child: PCrwStartView(hazardInvestigationTaskId: settings.arguments,),
                        ),

                    ///开始排查二级
                    "/PCrwStartDetailView": (context) => ViewModelProvider(
                      viewModel: PcrwViewModel(),
                      child: PCrwStartDetailView(hazardInvestigationRiskPointId: settings.arguments),
                    ),

                    ///开始排查登记隐患
                    "/PCrwYhdjPageView": (context) => ViewModelProvider(
                      viewModel: PcrwViewModel(),
                      child: PCrwYhdjPageView(map: settings.arguments,),
                    ),
                    
                    ///排查对象
                    "/ChoosePcdxView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child: ChoosePcdxView(),
                    ),

                    ///排查项
                    "/ChoosePcxView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child: ChoosePcxView(
                        settings.arguments
                      ),
                    ),

                    ///隐患类别
                    "/ChooseYhlbView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child: ChooseYhlbView(),
                    ),

                    ///核查人单选
                    "/ChoosePersonDan": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child: ChoosePersonDan(
                        settings.arguments
                      ),
                    ),

                    ///整改类型
                    "/ChooseZglxView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child: ChooseZglxView(),
                    ),

                    //查看图片
                    "/ShowImage": (context) => ViewModelProvider(
                          viewModel: TestViewModel(),
                          child: ShowImage(
                            imageInfo: settings.arguments,
                          ),
                        ),

                    ///排查任务登记隐患详情
                    "/PcrwyhDetailView": (context) => ViewModelProvider(
                      viewModel: PcrwViewModel(),
                      child: PcrwyhDetailView(pcMap:settings.arguments),
                    ),

                    ///隐患治理登记隐患详情
                    "/YhzlyhDetailView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child: YhzlyhDetailView(zlMap: settings.arguments),
                    ),

                    ///隐患治理核查
                    "/YhzlhcView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child:  YhzlhcView(id: settings.arguments),
                    ),
                    //整改
                    "/YhzlzgView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child:  YhzlzgView(zgMap: settings.arguments),
                    ),
                    //验收
                    "/YhzlysView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child:  YhzlysView(id: settings.arguments),
                    ),
                    "/YhzlpdView": (context) => ViewModelProvider(
                      viewModel: YhpcViewModel(),
                      child:  YhzlpdView(id: settings.arguments),
                    ),

                  };
                  WidgetBuilder builder = routes[settings.name];
                  return CupertinoPageRoute(builder: (ctx) => builder(ctx)


                      );
                },
                title: '青柠',
                localizationsDelegates: [
                  GlobalCupertinoLocalizations.delegate,
                  GlobalMaterialLocalizations.delegate,
                  GlobalWidgetsLocalizations.delegate
                ],
                supportedLocales: [
                  const Locale('zh', 'CH'),
                  const Locale('zh', 'CN'),
                ],
                theme: ThemeData(
                  primaryColor: SQColor.theme_color,
                  dividerColor: Color(0xffeeeeee),
                  scaffoldBackgroundColor: SQColor.white,
                  textSelectionColor: SQColor.white,
                  textTheme:
                      TextTheme(bodyText1: TextStyle(color: SQColor.black)),
                ),
                home:
            MediaQuery(
            ///设置文字大小不随系统设置改变
            data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
            child: AppScene1(),
            ),
            builder: EasyLoading.init(),
               )),
      ];
}
